package fieldmaps;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import org.apache.log4j.Logger;

//import fieldmaps.voronoi.delaunayLibrary.Pnt;
//import com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder;

public class VoronoiFilesGenerator {
	/**
	 * Genera un diagrama de Voronoi con la funcionalidad de la libreria JTS
	 */
	private final static Logger LOGGER = Logger
			.getLogger(VoronoiFilesGenerator.class);

	public static void main(String[] args) throws IOException,
			ClassNotFoundException {
		String folderName = "../Data/voronoi_data/";
		String fileName = "ejemplo";

		double xUpperLeft = -1000.0;
		double yUpperLeft = 2000.0;
		double xLowerRight = 3000.0;
		double yLowerRight = -4000.0;
		double MAX = 200;
		int N = 10;

		BufferedWriter bw = new BufferedWriter(new FileWriter(new File(
				folderName + fileName + ".voronoi")));
		for (int i = 0; i < N; i++) {
			bw.write(Math.random() * 700 + " " + Math.random()
					* 700 + " " + Math.round(Math.random() * MAX)
					+ "\r\n");
		}
		bw.close();

		bw = new BufferedWriter(new FileWriter(new File(folderName + fileName
				+ ".hdr")));
		bw.write("xUpperLeft" + "\t" + xUpperLeft + "\r\n");
		bw.write("yUpperLeft" + "\t" + yUpperLeft + "\r\n");
		bw.write("xLowerRight" + "\t" + xLowerRight + "\r\n");
		bw.write("yLowerRight" + "\t" + yLowerRight + "\r\n");
		bw.close();
	}
}
